package com.hyz.login.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hyz.login.model.Outpatienttype;
import com.hyz.login.mapper.OutpatienttypeMapper;
import com.hyz.login.service.OutpatienttypeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zwq
 * @since 2022-11-23
 */
@Service
public class OutpatienttypeServiceImpl
        extends ServiceImpl<OutpatienttypeMapper, Outpatienttype> implements OutpatienttypeService {

    @Autowired
    private OutpatienttypeMapper outpatienttypeMapper;

    @Override
    public IPage<Outpatienttype> findByLikeNamePage(String projectName, Integer page, Integer limit) {
        QueryWrapper<Outpatienttype> wrapper = new QueryWrapper<Outpatienttype>();
        wrapper.like("projectName",projectName);
        IPage<Outpatienttype> iPage = new Page<Outpatienttype>();
        iPage.setRecords(outpatienttypeMapper.findByLikeNamePage(projectName, page-1, limit));
        iPage.setCurrent(page);
        iPage.setTotal(outpatienttypeMapper.selectCount(wrapper));
        iPage.setSize(limit);
        return iPage;
    }
}
